﻿<UserControl x:Class="RiaCrm.Searching.SearchingView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Commands="clr-namespace:Microsoft.Practices.Composite.Presentation.Commands;assembly=Microsoft.Practices.Composite.Presentation"
    Margin="5">
    <UserControl.Resources>
        <Style x:Key="TitleBlock" TargetType="TextBlock">
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="TextAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
        </Style>
    </UserControl.Resources>

    <Border CornerRadius="20" BorderBrush="Silver" BorderThickness="3" Background="White" Canvas.ZIndex="2" Height="40">
        <Grid Margin="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            
            <TextBlock Grid.Column="0" Margin="5,3,10,0" Foreground="Gray">Serach for records:</TextBlock>
            
            <TextBox Grid.Column="1" x:Name="txbSearchBy" Margin="0,0,10,0" Height="22" Text="{Binding Path=SearchBy, Mode=TwoWay}" />
            
            <TextBlock Grid.Column="2" Margin="5,3,10,0" Foreground="Gray">Condition:</TextBlock>
            
            <ComboBox Grid.Column="3" 
                     x:Name="lbCondition" 
                     Margin="5,0,10,0" 
                     Width="150" 
                     Height="22" 
                     ItemsSource="{Binding Path=ConditionOptions}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}" Margin="1" Style="{StaticResource TitleBlock}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            
            <TextBlock Grid.Column="4" Margin="5,3,10,0" Foreground="Gray">Attribute:</TextBlock>
            
            <ComboBox Grid.Column="5" 
                     x:Name="cbSearchColumn" 
                     Margin="5,0,10,0" 
                     Width="200" 
                     Height="22" 
                     SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}"
                     ItemsSource="{Binding Path=Columns, Mode=OneWay}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Header}" 
                                   Margin="1" 
                                   Style="{StaticResource TitleBlock}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>

            <Button Grid.Column="6" 
                    x:Name="btnStartSearch" 
                    Margin="5,0,10,0" 
                    Width="60" 
                    Height="20" 
                    Content="Search"
                    Commands:Click.Command="{Binding searchCommand}"
                    Commands:Click.CommandParameter="{Binding Path=SearchBy}"
                    />
        </Grid>
    </Border>

</UserControl>
